package com.sky.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 竞赛类别状态枚举
 */
@Getter
@AllArgsConstructor
public enum CompetitionCategoryStatus {

    NOT_STARTED(0, "未开始"),
    IN_PROGRESS(1, "进行中"),
    EXPIRED(2, "已过期");

    private final Integer code;
    private final String description;

    /**
     * 根据状态码获取描述
     */
    public static String getDescriptionByCode(Integer code) {
        if (code == null) {
            return "";
        }
        for (CompetitionCategoryStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status.getDescription();
            }
        }
        return "未知状态";
    }
}
